<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>01-高亮用户的输入</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
	span.red{
		color: red;
	}
    </style>
</head>
<body>
	<div class="container" id="container">
		<h1>01-高亮用户的输入</h1>
		<div id="content">houdunren.com</div>
		<div>www.houdunren.com</div>
		<h1>houdunren.com</h1>
 		<h1>hdcms.com</h1>
	</div>
	<script src="../tools/utils.js"></script>
	<script type="text/javascript">
	var html = container.innerHTML
	function element2(tag) {
		var html = document.body.innerHTML;
		// ? 防止贪婪匹配
		var reg = new RegExp('<('+tag+')>.+?<\/\\1>', 'g')
		console.log(reg)
		return html.match(reg)
	}

	console.log(element('h1'))
	
	</script>
</body>
</html>